<?PHP
/*   This is a BSD style permissive license.
*    This module is original work by the author.
*
* Copyright (c) 2007, iNetOffice, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*     * Redistributions of source code must retain the above copyright
*       notice, this list of conditions and the following disclaimer.
*     * Redistributions in binary form must reproduce the above copyright
*       notice, this list of conditions and the following disclaimer in the
*       documentation and/or other materials provided with the distribution.
*     * Neither the name of iNetOffice nor the
*       names of its contributors may be used to endorse or promote products
*       derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY iNetOffice ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL iNetOffice BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Tom Snyder, iNetOffice, Inc.
*/

/* opensam_tryfilebrowse.php -- Browse files once logged on.
 *
 */


require_once( "opensam_sso.php" );
 
// we use php default session handling services:
session_start();

if( !isset( $_SESSION ) ) $_SESSION = array(); // to avoid warnings and hassles.

// The $g_login_state_message tells the user their current logged in state or reports errors.
// The defaul logged-in message is the current state of the logged in session var:
if( empty( $_SESSION['state'] ) || $_SESSION['state'] != "loggedin" ) {
	$g_login_state_message = "You are <font color=red><strong>Logged Out</strong></font> of the demonstration mode. Go <a href=\"opensam_trysso.php\">here</a> to log in.";
} else {
	$g_login_state_message = "You are <font color=#00A000><strong>Logged In</strong> as '".$_SESSION['StorageUserName']."'</font> at ".$_SESSION['StorageServerUrl']
	  . "</P><P class=halfabove><input type=submit name=Logout value=\"Logout\" style=\"padding:0 10pt 0 10pt\">";
}


?>
<html><head><title>OpenSAM File Browser</title>
<STYLE title=inetWord type=text/css>TD.iNetwordTDBrdr {
	BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.5pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.5pt; VERTICAL-ALIGN: top; BORDER-LEFT: black 1pt solid; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent; netwrd-type: internal
}
TD.iNetwordTD {
	PADDING-RIGHT: 5.5pt; PADDING-LEFT: 5.5pt; VERTICAL-ALIGN: top; BACKGROUND-COLOR: transparent; netwrd-type: internal
}
TABLE.iNetwordTABLE {
	BORDER-COLLAPSE: collapse; netwrd-type: internal
}
H1.MsoNormal {
	FONT-WEIGHT: bold; FONT-SIZE: 16pt; MARGIN: 12pt auto 6pt; FONT-FAMILY: Arial; mso-style-name: "Heading 1"
}
H2.MsoNormal {
	FONT-WEIGHT: bold; FONT-SIZE: 14pt; MARGIN: 12pt auto 3pt; FONT-STYLE: italic; FONT-FAMILY: Arial; mso-style-name: "Heading 2"
}
H3.MsoNormal {
	FONT-WEIGHT: bold; FONT-SIZE: 13pt; MARGIN: 12pt auto 3pt; FONT-FAMILY: Arial; mso-style-name: "Heading 3"
}
.iNetwordPageBreak {
	DISPLAY: block; BACKGROUND-IMAGE: url(/s/i/bg_pagebreak.gif); PAGE-BREAK-BEFORE: always; WIDTH: 100%; HEIGHT: 10px; netwrd-type: internal
}
TD {
	netwrd-type: internal
}
.MsoNormal, .l, .r {
	MARGIN-TOP: 0in; FONT-WEIGHT: 400; FONT-SIZE: 11pt; MARGIN-BOTTOM: 0in; TEXT-INDENT: 0pt; FONT-STYLE: normal; FONT-FAMILY: Tahoma; TEXT-ALIGN: left; mso-style-name: "Normal"
}
.l { PADDING-RIGHT:4px; TEXT-ALIGN:right; background-color: #9ACF19;
}
.halfabove {
	MARGIN-TOP: 5pt; FONT-WEIGHT: 400; FONT-SIZE: 11pt; MARGIN-BOTTOM: 0in; TEXT-INDENT: 0pt; FONT-STYLE: normal; FONT-FAMILY: Tahoma; TEXT-ALIGN: left; mso-style-name: "Normal"
}
.modest {
	MARGIN-TOP: 0in; FONT-WEIGHT: 400; FONT-SIZE: 10pt; MARGIN-BOTTOM: 0in; TEXT-INDENT: 0pt; FONT-STYLE: normal; FONT-FAMILY: Tahoma; TEXT-ALIGN: left; mso-style-name: "Normal"
}
.error {
	PADDING: 4px; FONT-SIZE: 11pt; TEXT-INDENT: 0pt; FONT-STYLE: normal; FONT-FAMILY: Tahoma; TEXT-ALIGN: left; background-color:yellow
}
</STYLE>
</head>
<body style="margin:0px; padding:0px">
<DIV style="background-image: url( http://www.opensam.org/pics/opensam%20logos/opensource_tools_bg.png )">
<IMG src="http://www.opensam.org/pics/opensam%20logos/opensource_tools_bg.png"></DIV>
<DIV style="padding:48px 36px 36px 36px">
<DIV class=MsoNormal style="TEXT-ALIGN: left" align=left>
<TABLE class=iNetwordTABLE style="MARGIN-LEFT: 0px; MARGIN-RIGHT: auto; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD class=iNetwordTD style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px">
<P style="MARGIN-BOTTOM: 0px"><A href="//www.opensam.org"><IMG height=65 src="http://www.opensam.org/pics/opensam%20logos/opensam_button_140x.png" width=140 border=0 x_orig_height="65" x_orig_width="140"></A></P></TD>
<TD class=iNetwordTD style="PADDING-RIGHT: 5.5pt; PADDING-LEFT: 30px; VERTICAL-ALIGN: middle">
<H1 class=MsoNormal style="MARGIN-TOP: 0pt;">OpenSAM File Browsing Module</H1>
<DIV class=MsoNormal style="TEXT-ALIGN: left" align=left>
<TABLE class=iNetwordTABLE style="MARGIN-LEFT: 0px; MARGIN-RIGHT: auto; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD class=iNetwordTD>
<P class=modest style="TEXT-ALIGN: right" align=right>specification:</P></TD>
<TD class=iNetwordTD>
<P class=modest><A href="http://www.opensam.org/5.1%20Opening%20Files.html">5.1 Opening Files</A></P></TD></TR>
<TR>
<TD class=iNetwordTD>
<P class=modest style="TEXT-ALIGN: right" align=right>downloads, php:</P></TD>
<TD class=iNetwordTD>
<P class=modest><a href="opensam_browse_webdav.tar">opensam_browse_webdav.tar</a>&nbsp;&nbsp;&nbsp;<a href="opensam_tryfilebrowse.php.txt">opensam_tryfilebrowse.php (this page)</a>
</P></TD></TR></TBODY></TABLE></DIV>
</TD></TR></TBODY></TABLE></DIV>
<form name=frm action="opensam_trysso.php" method=GET style="margin-left:36px">
<P class=MsoNormal >&nbsp;</P>
<p class=MsoNormal>&nbsp;</p>
<h3 class=MsoNormal>OpenSAM File Browser</h3>
<P class=MsoNormal><small>Click folders and files to browse the files stored on the WebDAV server.</small></P>
<P class=MsoNormal >&nbsp;</P>
<P class=MsoNormal><?PHP print $g_login_state_message; ?></P>
<P class=MsoNormal >&nbsp;</P>
<IFRAME src="opensam_browse_webdav.php?Context=demo" style="width:240px; height:300px"></IFRAME>
<p class=MsoNormal>&nbsp;</p>
<P class=MsoNormal ></P>
</form>
</body>
</html>
